package com.xjgc.eip.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DbConn {

	private Connection conn = null;

	public Connection getConnetion() {
		try {
			// Class.forName("oracle.jdbc.OracleDriver");
			Class.forName("sgcc.nds.jdbc.driver.NdsDriver");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		try {
//			conn=DriverManager.getConnection("jdbc:nds://10.100.9.88:18600/v_18600_dzmes?appname=app_dzmes","system","q1w2e3r4");
//			conn = DriverManager.getConnection("jdbc:nds://10.100.9.88:18600/v_18600_saptest?appname=app_sddz","postgres", "postgres");
			//????????
//			conn = DriverManager.getConnection("jdbc:nds://10.100.9.88:18600/v_18600_eip_prod?appname=app_eip_prod","postgres", "Xjgc@28!.");
			//???????
			conn = DriverManager.getConnection("jdbc:nds://10.100.9.88:18600/v_18600_eip_test?appname=app_eip_test","postgres", "postgres");

		} catch (SQLException e1) {
			e1.printStackTrace();
		}
		return conn;
	}

	public void closeCn() {
		if (conn != null) {
			try {
				if (!conn.isClosed()) {
					conn.close();
					// System.out.println("Connection is closed!");
				}
			} catch (SQLException e) {
			}
		}
	}

}
